package com.zhidisoft.enums;

public enum EntityStatus {
	
	DISABLE(0,"禁用"),ENABLE(1,"可用"),REMOVE(2,"已删除");
	
	private Integer code;
	
	private String label;
	
	private EntityStatus(Integer code,String label){
		this.code = code;
		this.label = label;
	}

	public Integer getCode() {
		return code;
	}

	public String getLabel() {
		return label;
	}
	
	/**
	 * 根据编码获取状态常量
	 * @param code
	 * @return
	 */
	public static EntityStatus getByCode(Integer code){
		EntityStatus status = null;
		for(EntityStatus es : values()){
			if(es.code.equals(code)){
				status = es;
			}
		}
		return status;
	}

}
